﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RpgLibrary.TalentClasses
{
    public enum TalentType { Passive, Sustained, Activated }

    public class TalentData : IRpgDataObject
    {
        #region Field Region

        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public string[] AllowedClasses;
        public Dictionary<string, int> AttributeRequirements;
        public string[] TalentPrerequisites;
        public int LevelRequirement;
        public TalentType TalentType;
        public int ActivationCost;
        public string[] Effects; 

        #endregion

        #region Constructor Region

        public TalentData()
        {
            AttributeRequirements = new Dictionary<string, int>();
        }
        
        #endregion
        
        #region Method Region
        #endregion
        
        #region Virtual Method region
        
        public override string ToString()
        {
            return String.Concat(Name, ", ", 
                String.Join(", ", AllowedClasses), ", ",
                AttributeRequirementsToString(), ", ",
                String.Join(", ", TalentPrerequisites), ", ",
                LevelRequirement, ", ",
                TalentType, ", ",
                ActivationCost, ", ",
                String.Join(", ", Effects));
        }

        private string AttributeRequirementsToString()
        {
            string toString = string.Empty;
            foreach (string s in AttributeRequirements.Keys)
                toString += ", " + s + "+" + AttributeRequirements[s].ToString();

            return toString;
        }
        
        #endregion
    }
}
